package com.bls.cate.ui.activity.login;

import android.content.Context;
import android.widget.EditText;

import com.blankj.utilcode.util.RegexUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.bls.cate.constant.Constant;
import com.bls.cate.mvp.BasePresenter;
import com.bls.cate.mvp.BasePresenterImpl;
import com.bls.cate.mvp.BaseView;

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class LoginContract {
    interface View extends BaseView {
        /**
         * 登录
         */
        void onViewLogin(String username, String pwd);
    }

    interface Presenter extends BasePresenter<View> {

        /**
         * 检查账户密码输入格式
         *
         * @param etUsername 账户
         * @param etPassword 密码
         */
        void onLogin(EditText etUsername, EditText etPassword);
    }

/*    class LoginPresenter extends BasePresenterImpl<View> implements Presenter {

        @Override
        public void onLogin(EditText etUsername, EditText etPassword) {
            String username = etUsername.getText().toString().trim();
            String pwd = etPassword.getText().toString().trim();
            if (!(RegexUtils.isMobileSimple(username) || RegexUtils.isEmail(username)))
                ToastUtils.showShort("请填写手机号或邮箱");
            else if (pwd.length() < Constant.PASSWORD_LENGTH)
                ToastUtils.showShort("密码长度不小于".concat(String.valueOf(Constant.PASSWORD_LENGTH)).concat("位"));
            else mView.onViewLogin(username, pwd);
        }
    }*/
}
